﻿using AfrikDotnetWebSite.Models;
using System.Linq;
using System.Web.Mvc;

namespace AfrikDotnetWebSite.Controllers
{
    public class HomeController : Controller
    {
        AfrikDotnetContext db = new AfrikDotnetContext();

        protected override void Dispose(bool disposing)
        {
            db.Dispose();
            base.Dispose(disposing);
        }

        public ActionResult Index()
        {
            ViewBag.Shows = db.Shows.Where(s => s.IsActive).OrderByDescending(s => s.Id);
            ViewBag.News = db.News.OrderByDescending(s => s.Date).Take(3);
            return View();
        }
    }
}
